"use strict"
//苹果登录
const NAMETEST = /^[a-zA-Z0-9_-]{3,64}$/;

exports.format = {
    "id":'apple',
    "name":"苹果登录",
    "fields":{
        "appid" :{'type':'string','val':'','name':"随便填"},
    }
};

//登录与认证TOKEN
exports.login = function () {
    let code = this.get("code");
    if(!code){
        return this.error("code empty");
    }
    // if(!NAMETEST.test(code)){
    //     return this.error("code illegal",'a-zA-Z0-9_-')
    // }
    return code;
}

exports.orderCreate = function(config){
    let data = {};
    data["rmb"] = config['rmb'];
    data["attach"] = config['attach'];
    data["orderid"] = config['orderid'];
    return data;
}

/**
 * @name orderNotify
 * 验证平台发货信息
 */
exports.orderNotify = function(){
    let attach = this.get("attach",'string');
    let orderid = this.get("orderid",'string');
    return {"attach":attach,"orderid":orderid}
}

/**
 * @name orderResult
 * 包装游戏服发货信息
 */
exports.orderResult = function(err,ret){
    return err?err:ret;
}